package brainsplash.gyrusscope.game;

import brainsplash.gyrusscope.framework.gl.TextureRegion;

public class Asteroid extends BaseObject {
	public int damage;
	public int health = 200;
	
	public Asteroid(TextureRegion sprite, int x, int y, int radius, float distanceFromCenter, float direction, float speed, int damage) {
		super(sprite, x, y, radius, distanceFromCenter, direction, speed);
		this.damage = damage;
	}
	
	public int collisionWith(Player p) {
		int d = (int) (Math.sqrt(Math.pow(p.x-x, 2) + Math.pow(p.y-y, 2)));
		if (this.size / 2 + p.size / 2 > d) {
			Assets.vibrate(100);
			p.health -= damage;
			if (p.health <= 0) {return 2;} 
			else {return 1;}
		}
		return 0;
	}
}
